home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 922 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.4 KB

  1. From: kanze@gabi-soft.fr (J. Kanze)
  2. Message-ID: <KANZE.96Mar29114545@gabi.gabi-soft.fr>
  3. X-Original-Date: 29 Mar 1996 10:45:45 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 01 Apr 96 08:36:42 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: static members as members of a metaclass h
  9. Organization: GABI Software, Sarl.
  10. References: <4jc5lt$doh@arl-news-svc-2.compuserve.com> <4jckdc$ad6@engnews1.Eng.Sun.COM>
  11. In-Reply-To: clamage@Eng.Sun.COM's message of 28 Mar 96 09:26:03 GMT
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMV+VteEDnX0m9pzZAQHi+wGAnx1rr9dCkaLgqsJb7QRpyIvy8bI/Bak9
  14.     4zDP0w0KB0ImwKsoXiePGYkfUdritwq9
  15.     =eKz/
  16.  
  17. In article <4jckdc$ad6@engnews1.Eng.Sun.COM> clamage@Eng.Sun.COM (Steve
  18. Clamage) writes:
  19.  
  20.     [...]
  21. |> I believe a reasonable solution to the problem of initialization of
  22. |> non-local static data is not to use non-local static data!
  23.  
  24. |> Instead of a static data object or static class data member, use a 
  25. |> function with a local static object.
  26.     [...]
  27. |> Only two features are missing, compared to non-local static objects:
  28.  
  29. |> 1. If you never reference an object, it is never initialized.
  30.  
  31. But is this guaranteed by the standard anyway?  I know that I have a
  32. significant number of static objects which must be initialized before
  33. main (but in any order), but I have always believed that this works
  34. because of the way current compilers work, and not because of anything
  35. in the standard.
  36.  
  37. |> 2. The order of destruction remains unspecified. If that is a problem,
  38. |> possibly the static objects could be of a type which has a do-nothing
  39. |> destructor and a "destroy" member function which could be called
  40. |> explicitly at the proper time.
  41.  
  42. I thought that the order of destruction was the reverse of
  43. initialization.  This is what it says in the January draft, at least.
  44. Has this been changed?
  45. -- 
  46. James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
  47. GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
  48. Conseils en informatique industrielle --
  49.                             -- Beratung in industrieller Datenverarbeitung
  50. ---
  51. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  52. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  53. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  54. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  55. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  56.